package com.lin;

import java.util.HashMap;
import java.util.Map;

// 寻找重复数字
public class Solution287 {
    public int findDuplicate(int[] nums) {
        Map<Integer,Integer> map = new HashMap<>();
        for (int num : nums) {
            if (map.containsKey(num)){
                return num;
            }
            else {
                map.put(num,1);
            }
        }
        return 1;
    }
}
